package com.example.day24;

import java.lang.reflect.Method;

/**
 * @author Lenovo
 */
public class ReflectDemo06 {
    public static void main(String[] args) throws Exception {
        //获取Class对象
        Class<?> c = Class.forName("com.itheima_02.Student");
        Method[] methods = c.getDeclaredMethods();
        for (Method method : methods) {
            System.out.println(method);
        }
        System.out.println("--------");
        method m =c.getMethod("method1");
        Constructor<?> con = c.getConstructor();
        Object obj = con.newInstance();
        m.invoke(obj);
    }
}
